package com.cxs.netmanager.slice;

import com.cxs.netmanager.ResourceTable;
import com.cxs.netmanager.utils.MyHttp;
import com.cxs.netmanager.utils.MyResponse;
import com.cxs.netmanager.utils.ResponseCallBack;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Text;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

public class MainAbilitySlice extends AbilitySlice {
    static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00101, "MainAbility");
    Text text;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);
        text = (Text)findComponentById(ResourceTable.Id_text_helloworld);

        MyHttp.get("https://www.baidu.com", new ResponseCallBack() {
            @Override
            public void onSuccess(String var1) {
                HiLog.info(LABEL, var1);
            }

            @Override
            public void onError(MyResponse response) {
                HiLog.info(LABEL, response.code + "");
            }
        });
    }


    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
